<template>
	<view class="search-hot-list-container">
		<view class="search-hot-title">慕课热搜 - 全网技术 一网打尽</view>
		<block v-for="(item,index) in hotList" :key="index">
			<view class="search-hot-item" @click="onItemClick(item.label)">
				<hot-ranking :ranking="index+1"></hot-ranking>
				<text class="title line-clamp">{{item.label}}</text>
				<image v-if="index<=2" class="search-hot-icon" src="/static/images/hot-icon.png"></image>
			</view>
		</block>
	</view>
</template>

<script>
	export default {
		name:"search-hot-list",
		props:{
			hotList:{
				type:Array,
				default: () => {
					return {}
				}
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			// item的点击事件
			onItemClick(val){
				this.$emit("onSearch",val)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.search-hot-list-container{
		.search-hot-title{
			font-weight: bold;
			font-size: $uni-font-size-base;
			color: $uni-text-color-hot;
			padding: 0 $uni-spacing-col-lg $uni-spacing-col-lg $uni-spacing-col-lg;
			margin: 0 -12px $uni-spacing-col-lg -12px;
			box-shadow: 2px 2px 5px 1px rgba(143,143,143,0.1);
		}
		.search-hot-item{
			display: flex;
			align-items: center;
			padding: $uni-spacing-col-lg 0;
			.title{
				color: $uni-text-color;
				font-size: $uni-font-size-base;
				margin: 0 $uni-spacing-row-base;
			}
			.search-hot-icon{
				width: 14px;
				height: 14px;
			}
		}
	}
</style>
